package leetcode.剑指offer.剑指II;

import org.junit.Test;

import java.util.Arrays;
import java.util.PriorityQueue;

/**
 * @author :songyaozhang
 * @date :Created 2021/9/10 14:06
 * @description :
 */
public class 剑指_II_59_1_队列的最大值 {
  @Test
  public void test() {

  }

    class MaxQueue {
    private int[] nums;
    private int head;
    private int tail;

        public MaxQueue() {
          nums = new int[10000];
          head = 0;
          tail = 0;
        }

        public int max_value() {
          if (isEmpty()) return -1;
          return Arrays.stream(nums).max().getAsInt();
        }

        public void push_back(int value) {
          nums[tail++] = value;
        }

        public int pop_front() {
          if (isEmpty()) return -1;
          int num = nums[head];
          nums[head] = 0;
          head++;
          return num;
        }

        public boolean isEmpty() {
          return head == tail;
        }
    }


}
